<%--
  Created by IntelliJ IDEA.
  User: lijun
  Date: 2019/12/19
  Time: 10:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>还款明细</title>
    <link rel="stylesheet" href="css/bootstrap.min.css" />
    <script type="text/javascript" src="js/jquery-1.12.4.js"></script>
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
    <script type="text/javascript">
        $(function(){
            $('#pagination').twbsPagination({
                totalPages : 1,
                startPage : 1,
                visiblePages : 5,
                first:"首页",
                prev:"上一页",
                next:"下一页",
                last:"最后一页",
                onPageClick : function(event, page) {
                    $("#currentPage").val(page);
                    $("#searchForm").submit();
                }
            });

            $("#query").click(function(){
                $("#currentPage").val(1);
                $("#searchForm").submit();
            });

            $(".beginDate,.endDate").click(function(){
                WdatePicker();
            });

            $(".return_money").click(function(){
                var useableAmount=parseFloat($("#useableAmount").val());
                var returnMoney=parseFloat($(this).data("returnmoney"));
                if(useableAmount>=returnMoney){
                    $.ajax({
                        dataType:"json",
                        type:"POST",
                        url:"/returnMoney.do",
                        data:{id:$(this).data("rid")},
                        success:function(data){
                            if(data.success){
                                $.messager.confirm("提示","还款成功",function(){
                                    window.location.reload();
                                });
                            }else{
                                $.messager.popup(data.msg);
                            }
                        }
                    });
                }else{
                    $.messager.popup("钱不够!");
                }
            });
        });
    </script>
</head>
<body>
<div class="col-sm-8">
    <form action="/borrowBidReturn_list.do" name="searchForm" id="searchForm" class="form-inline">
        <input type="hidden" id="currentPage" name="currentPage" value="">
        <div class="form-group">
            <label>时间范围</label>
            <input type="text" class="form-control beginDate" name="beginDate" value="">
        </div>
        <div class="form-group">
            <label></label>
            <input type="text" class="form-control endDate" name="endDate" value="">
        </div>
        <div class="form-group">
            <label>状态</label>
            <select class="form-control" name="state">
                <option value="-1" selected="selected">全部</option>
                <option value="0">待还款</option>
                <option value="1">已还款</option>
                <option value="2">逾期</option>
            </select>
            <script type="text/javascript">
                $("[name=state] option[value='-1']").attr("selected","selected");
            </script>
        </div>
        <div class="form-group">
            <button id="query" class="btn btn-success"><i class="icon-search"></i> 查询</button>
        </div>
    </form>
    <div class="panel panel-default">
        <div class="panel-heading">
            <span class="pull-left" style="line-height: 35px;">还款明细</span>
            <a class="pull-right btn btn-danger btn-sm" href="recharge.jsp"><%--href="/recharge.do"--%>

                账户充值
            </a>
            <div class="clearfix"></div>
        </div>
        <input type="hidden" id="useableAmount" value="0">
        <table class="table">
            <thead>
            <tr>
                <th>借款</th>
                <th>还款金额</th>
                <th>还款本金</th>
                <th>还款利息</th>
                <th>还款期数</th>
                <th>还款期限</th>
                <th>还款状态</th>
            </tr>
            </thead>
            <tbody>
            </tbody>
        </table>
        <div style="text-align: center;">
            <ul id="pagination" class="pagination"><li class="first disabled"><a href="#">首页</a></li><li class="prev disabled"><a href="#">上一页</a></li><li class="page active"><a href="#">1</a></li><li class="next disabled"><a href="#">下一页</a></li><li class="last disabled"><a href="#">最后一页</a></li></ul>
        </div>
    </div>
</div>
</body>
</html>

